<template>
		<div class="wrap-case-detail">
			<div class="detail-nav-title">
				<router-link tag='a' :to="'/index'" >首页</router-link> >
				<router-link tag='a' :to="'/imgcase'" >装修效果图</router-link> >
				<a>{{detail.schemeName}}</a>
			</div>
			<div class="detail-head">
				<div class="detail-head-left">
					<img :src="detail.layoutmap">
				</div>
				<div class="detail-head-right">
					<h2>{{detail.schemeName}}</h2>
					<p>所属公司：{{detail.name}}</p>
					<p>设计师：{{detail.designer}}</p>
					<p>户型：{{detail.door}}</p>
					<p>面积：{{detail.fixArea}}㎡</p>
					<p>造价：{{detail.fixMoney}}</p>
				</div>
			</div>
			<div class="detail-box">
				<div>
          <el-button v-if="title.images.length !== 0" v-for="(title, index) in detail.items" :key="index" size="medium" @click="getImg(title)">{{title.positionName}}</el-button>
        </div>
				<div class="detail-box-pub">
					<!-- <h1>客厅</h1> -->
          <img v-for="(item, index) in imgList.images" :key="index" :src="item.value">
					<!-- <img src="image/case01.jpg" alt=""> -->
					<!-- <img src="image/case01.jpg" alt=""> -->
				</div>
			</div>
		</div>
</template>

<script>
export default {
  data () {
    return {
    	detail: [],
    	imgList: []
    }
  },
  methods: {
  	getQuery () {
  		var that = this
  		var id = that.$route.query.id
  		if (id) {
  			that.$axios.request('/CompanyScheme/SchemeDetail', {
  				SchemeIndex: id
  			})
  				.then((res) => {
  					if (res.code === 0) {
  						that.detail = res.data
  						that.detail.door = that.detail.door.value
  						that.detail.fixArea = that.detail.fixArea.value
  						that.detail.fixMoney = that.detail.fixMoney.value
  						that.detail.fixStyle = that.detail.fixStyle.value
  						that.imgList = res.data.items[0]
  					}
  				})
  		} else {
  			that.$router.push({
  				name: 'index'
  			})
  		}
  	},
  	getImg: function (title) {
      var that = this
      for (var i = 0; i < that.detail.items.length; i++) {
        if (that.detail.items[i].positionIndex === title.positionIndex) {
          that.imgList = that.detail.items[i]
        }
      }
    }
  },
  mounted () {
  	this.getQuery()
  }
}
</script>
